GBML manual / Constants

SPRITE_LEAN_BACK

The bottom of the picture stays full size and the top shrinks away - like a sign tipped back, with its top edge farther from you.

Works differently on Game Boy - The Game Boy narrows the picture on some lines by moving its two sprite pieces toward each other (the middle is covered, not squeezed), a drum or a band hides it outside the lens; 16 pixels wide at most, one picture at a time; the size is not used.

Works differently on Game Boy Color - The Game Boy Color narrows the picture on some lines by moving its two sprite pieces toward each other (the middle is covered, not squeezed), a drum or a band hides it outside the lens; 16 pixels wide at most, one picture at a time; the size is not used.

Sega Genesis: not built yet

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

SPRITE_LEAN_BACK: constant

Description

Names the tipped-back shape, for draw_sprite_3d and draw_sprite_3d_scaled: the bottom of the picture stays full size and the top shrinks away, like a sign tipped back so its top edge is farther from you. It is the sprite's own name for the curve TEXT_LEAN_BACK gives a line of text.

A real capture - a flat striped lighthouse on the left of each picture, and on the right the same lighthouse drawn with SPRITE_LEAN_BACK at depth 1, 2 and 3. The deeper it goes, the narrower the top of the curved lighthouse gets while its bottom stays as wide as the flat oneA real capture - a flat striped lighthouse on the left of each picture, and on the right the same lighthouse drawn with SPRITE_LEAN_BACK at depth 1, 2 and 3. The deeper it goes, the narrower the top of the curved lighthouse gets while its bottom stays as wide as the flat one
A real capture - a flat striped lighthouse on the left of each picture, and on the right the same lighthouse drawn with SPRITELEANBACK at depth 1, 2 and 3. The deeper it goes, the narrower the top of the curved lighthouse gets while its bottom stays as wide as the flat one

In each picture the flat lighthouse (plain draw_sprite) is on the left and the lean, at depth 1, 2 and then 3, is on the right. A tall striped lighthouse stands in for the example's spr_doc_tower. Real pictures from a Game Boy Advance ROM.

A real capture, 12 frames played in a loop - a plain striped lighthouse on the left stands still while the one on the right is drawn with SPRITE_LEAN_BACK while the depth goes 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1 and 2. At depth 3 the top is far narrower than the bottom, and at depth 0 the curved lighthouse is just the same as the flat one. The first frame, which is all a viewer that cannot animate shows, is depth 3, the page's example.A real capture, 12 frames played in a loop - a plain striped lighthouse on the left stands still while the one on the right is drawn with SPRITE_LEAN_BACK while the depth goes 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1 and 2. At depth 3 the top is far narrower than the bottom, and at depth 0 the curved lighthouse is just the same as the flat one. The first frame, which is all a viewer that cannot animate shows, is depth 3, the page's example.
A real capture, 12 frames played in a loop - a plain striped lighthouse on the left stands still while the one on the right is drawn with SPRITELEANBACK while the depth goes 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1 and 2. At depth 3 the top is far narrower than the bottom, and at depth 0 the curved lighthouse is just the same as the flat one. The first frame, which is all a viewer that cannot animate shows, is depth 3, the page's example.

The same call with only depth changing (the line under the picture says which depth): twelve real pictures played in a loop, each held for about a third of a second. The plain lighthouse on the left is draw_sprite and never changes. A viewer that does not animate shows the first frame, depth 3.

A sprite's lean goes from depth 1 (gentle) to depth 3 (deep): the top is drawn at about 80%, 67% and 57% of its width. A bigger number is treated as 3. Read draw_sprite_3d for why a sprite stops at 3, and what the call costs. With a negative yscale in draw_sprite_3d_scaled the picture is turned upside down and so is the lean: it looks like SPRITE_LEAN_FORWARD.

Example

draw_sprite_3d(spr_doc_tower, x, y, 0, SPRITE_LEAN_BACK, 3);

The tower with its top edge tipped away from you, like a sign leaning back.

See also: draw_sprite_3ddraw_sprite_3d_scaledTEXT_LEAN_BACKSPRITE_BULGESPRITE_LEAN_FORWARDSPRITE_DRUM